package com.ashley.day_0607;

public class ArrayTest1 {

	public static void main(String[] args) {
		int[] arr = new int[6];//声明并初始化一维数组
		for (int i = 0; i < arr.length; i++) {
			arr[i] = (int) (Math.random() * (30 - 1 + 1) + 1);//数组中的元素赋值
			for (int j = 0; j < i; j++) {
				if (arr[i] == arr[j]) {//判断每个元素的赋值是否相同
					i--;
					break;
				}
			}
		}
		for (int i = 0; i < arr.length; i++) {//遍历数组
			System.out.println(arr[i]);
		}
	}

}
